*** Settings ***
Library           RequestsLibrary
Library           Collections

*** Test Cases ***
login
    Create Session    api    http://8.129.162.225:8082
    ${params}    Create Dictionary    username=demo    password=demo
    ${res}    Post Request    api    /account/login    params=${params}
    Should Be Equal As Strings    ${res.status_code}    200    #判断返回结果是不是200
    ${res}    To Json    ${res.content}    #将相应结果转换为json格式
    ${resdata}    Get From Dictionary    ${res}    data
    ${token}    Get From Dictionary    ${resdata}    token
    log    ${res}
    log    ${token}
    Set Suite Variable    ${token}

info
    Create Session    api    http://8.129.162.225:8082
    ${headers}    Create Dictionary    Authorization=${token}
    ${res}    Get Request    api    /account/info    headers=${headers}
    Should Be Equal As Strings    ${res.status_code}    200    #判断返回结果是不是200
    ${res}    To Json    ${res.content}    #将相应结果转换为json格式
    log    ${res}
